/**
 * Created by 小敏哥 on 2017/8/16.
 * 支付详情
 */

import React, {Component} from 'react';
import style from './index.scss';

class AccountDetail extends Component {
    constructor(props) {
        super(props);
    }

    static propTypes = {
        price: React.PropTypes.number,//订单金额
        couponDiscount: React.PropTypes.number,//优惠券优惠金额
        isVip: React.PropTypes.bool,//跳转到优惠券列表
        vipDiscount:React.PropTypes.number,//车务卡优惠金额
        activityTitle:React.PropTypes.string,//活动标题
        activityDiscount:React.PropTypes.number//活动折扣
    };

    render(){
        return <div className={style.accountDetail}>
            <div className={style.detailItem}>
                <span className={style.itemLeft}>订单金额</span>
                <span className={style.itemRight}>{'￥' + (this.props.price ? this.props.price : 0)}</span>
            </div>
            {this.props.couponDiscount > 0 ? <div className={style.detailItem}>
                    <span className={style.itemLeft}>优惠券</span>
                    <span
                        className={style.itemRight}>{'-￥' + (this.props.price - this.props.couponDiscount > 0 ? this.props.couponDiscount : this.props.price)}</span>{/*确保优惠券金额小于总金额*/}
                </div> : ''}
            {this.props.couponDiscount <= 0 && this.props.isVip ? <div className={style.detailItem}>
                    <span className={style.itemLeft}>车务卡减免</span>
                    <span className={style.itemRight}>{'-￥' + this.props.vipDiscount}</span>
                </div> : ''}
            {this.props.activityTitle && this.props.activityTitle.length > 0 ?
                <div className={style.detailItem}>
                    <span className={style.itemLeft}>{this.props.activityTitle}</span>
                    <span className={style.itemRight}>{'-￥' + this.props.activityDiscount}</span>
                </div> : ''
            }
        </div>
    }
}


export default AccountDetail
